<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>竞拍</title>
<link href="../css/common.css" rel="stylesheet" type="text/css" />
<link href="../css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../js/jquery-1.8.3.js"></script>
</head>

<body>
<div class="wrap">
<!-- main begin-->
  <div class="sale">
    <h1 class="lf">在线拍卖系统</h1>
    <div class="logout right"><a href="#" title="注销">注销</a></div>
  </div>
  <div class="items sg-font lf">
      <ul class="rows">
        <li>名称：</li>
        <li class="borderno">${auction.auctionName}</li>
      </ul>
      <ul class="rows">
        <li>描述：</li>
        <li class="borderno">${auction.auctionDesc}</li>
      </ul>
      <ul class="rows">
        <li>开始时间：</li>
        <li class="borderno">${auction.auctionStartTime}</li>
      </ul>
      <ul class="rows">
        <li>结束时间：</li>
        <li class="borderno">${auction.auctionEndTime}</li>
      </ul>
      <ul class="rows border-no">
        <li>起拍价：</li>
        <li class="borderno">${auction.auctionStartPrice}</li>
      </ul>
  </div>
  <div class="rg borders"><img src="../images/ad20.jpg" width="270" height="185" alt="" /></div>
  <div class="cl"></div>
  <div class="top10 salebd">
       <p>
       <label for="sale">出价：</label>
       <input type="text"  class="inputwd" id="sale" value="4000"/>
       <input name="" type="button" value="竞 拍" class="spbg buttombg f14  sale-buttom" onclick="addRecord()" />
       </p>
       <p class="f14 red">不能低于最高竞拍价</p>
  </div>
  <div class="top10">
    <input name="" type="button" value="刷 新" class="spbg buttombg f14" onclick="javascript:location.reload();" />
    <input name="" type="button" value="返回列表" class="spbg buttombg f14" onclick="javascript:location.href='auction?action=list&pageIndex=1';" />
  </div>
  <div class="offer">
    <h3>出价记录</h3>
    <div class="items sg-font">
      <ul class="rows even strong">
        <li>竞拍时间</li>
        <li>竞拍价格</li>
        <li class="borderno">竞拍人</li>
      </ul>
        <c:forEach items="${requestScope.auction.auctionRecords}" var="record">
      <ul class="rows">
        <li>${record.auctionTime}</li>
        <li>${record.auctionPrice}</li>
        <li class="borderno">${record.userName}</li>
      </ul>
        </c:forEach>
  </div>
  </div>
<!-- main end-->
</div>
<script type="text/javascript">


    function addRecord() {
        //出价
        var sale = $("#sale").val();
        //最高价
        var lastPrice = $(".rows:last").children().eq(1).text();
        console.log(sale+' '+lastPrice);
        if(lastPrice >= sale){
            return ;
        }
        //发送请求到后台，添加竞拍记录
        location.href="auction?action=record&auctionId=${requestScope.auction.auctionId}&auctionPrice="+sale;
    }
</script>
</body>
</html>
